var should = require('should');
var cdkHandler = require('../../../app/servers/user/handler/cdkHandler');
var config = require('../../config');
var configUtil = require('../../../app/util/configUtil');
var analyze = require('kc-analyze');

var mongoConnector = require('../../../app/libs/mongodb/mongoConnector');
var cdkTypeModel = mongoConnector().model('CdkType');

suite('测试cdkHandler', function () {
    suite('verify', function () {
        test('初始化', function (done) {
            var analyze_config = configUtil.load('analyze');
            var game_config = configUtil.load('game');
            analyze.initialize({
                host: analyze_config.host,
                server_id: game_config.server_id
            });
            done();
        });

        test('验证激活码', function (done) {
            var msg = {};
            var session = {};
            session.uid = config.other_role_id;

            var cdk_handler = new cdkHandler();
            cdk_handler.verify(msg, session, function (err, res) {
                done();
            });
        });

        test('验证激活码', function (done) {
            var msg = {
                cdk_id: "00IDwO9aVZ"
            };
            var session = {};
            session.uid = config.other_role_id;

            var cdk_handler = new cdkHandler();
            cdk_handler.verify(msg, session, function (err, res) {
                //console.log('res: ', res);
                done();
            });
        });
    });
});
